﻿function Main() {
    LivenUpDoc();
    ShowEditor();
}

function LivenUpDoc() {

    var tables = document.getElementsByTagName('table');
    for (var i = 0; i < tables.length; i++) {
        $(tables[i]).attr('id',  i);
        LivenUpTable(tables[i]);
    }
}

function LivenUpTable(table) {
    var cell = null;
    for(var i=0;i<table.rows.length;i++){
        for (var j = 0; j < table.rows[i].cells.length; j++) {
            cell = table.rows[i].cells[j];
            clID=table.id + '_' + i + '_' + j
            $(cell).attr('id', clID);
            Ext.get(clID).on('contextmenu', function (e) {
                currentXY = e.getXY();
                e.preventDefault();
                contextMenuTD.args = this.id;
                contextMenuTD.showAt(e.getXY());
                //ShowEditor(e.getXY());
            });

        }}
}